package com.cloud.core.widget.decoration;

import android.graphics.Rect;
import android.view.View;

import androidx.recyclerview.widget.RecyclerView;

/**
 * Created by Tanghaibo
 * 2018/4/8
 * description: linear_recycle 间隔
 */

public class LinearVerticalDecoration extends RecyclerView.ItemDecoration {
    private int mSpace;

    public LinearVerticalDecoration(int space) {
        this.mSpace = space;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);
        if (parent.getChildAdapterPosition(view) != 0) {
            outRect.top = mSpace;
        }

    }

}
